#include <stdio.h>
#include <stdlib.h>
int main()
{
	FILE *fp;
	char ch;
	int count=0;
	if((fp=fopen("textfile.txt","w"))==NULL)
	{
		printf("Can not open file");
		exit(0);
	}
	while((ch=getchar())!='\n')
		fputc(ch,fp);
	fclose(fp);
	if((fp=fopen("textfile.txt","r"))==NULL)
	{
		printf("Can not open file");
		exit(0);
	}
	while((ch=fgetc(fp))!=EOF)
	{
		if(ch==32)
			count++;
	}
	fclose(fp);
	printf("These are %d spaces.\n",count);
	return 0;
}